<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 如果只想获取键名，或者只想获取键值，可以写成下面这样。
        const map = new Map();
        map.set('first', 'hello');
        map.set('second', 'world');
        // 获取键名
        for (let [key] of map) {
            // ...
            console.log(key);
        }

        // 获取键值
        for (let [, value] of map) {
            // ...
            console.log(value);
        }

    </script>
</body>

</html>